import React from 'react';
import {
  StyleSheet,
  Text,
  View,
  SafeAreaView,
  Linking,
  Button,
} from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';

const App = () => {
  const tabList = [
    {
      id: '1',
      name: 'tab1',
    },
    {
      id: '2',
      name: 'tab2',
    },
    {
      id: '3',
      name: 'tab3',
    },
  ];
  return (
    <SafeAreaView style={styles.container}>
      <View style={styles.layer}>
        {tabList.map(item => (
          <Text style={styles.textred} key={item.id}>
            {item.name}
          </Text>
        ))}
      </View>
      <View>
        <Text>文本内容1</Text>
      </View>
      <View>
        <Icon name="home" size={40} color="red" />
        <Button
          title="打开外部连接"
          color="red"
          onPress={() => {
            Linking.openURL('https://www.zhihu.com/');
          }}
        />
      </View>
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    color: 'white',
    backgroundColor: 'gray',
  },
  layer: {
    display: 'flex',
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
  },
  textred: {
    flex: 1,
    textAlign: 'center',
    height: 40,
    lineHeight: 40,
    color: 'red',
  },
});

export default App;
